package com.prj.ufdm.demo.tutorial.despatterns.behavioral.observer;

import java.util.Enumeration;
import java.util.Vector;
/**
 * ConcreteAbstractSubject  抽象类，除了实现  Subject 的方法外
 * 
  *  将有关状态存入各对象ConcreteObserver
 * @author Administrator
 *
 */
public abstract class SubjectAbstract implements Subject {

	private Vector<Observer> vector = new Vector<Observer>();  
	
	/*目标对象调整状态*/  
    public abstract void setState(String act, String str);
    /*观察者查询状态*/  
    public abstract Vector<String> getState();
	
    
	@Override
	public void add(Observer observer) {
		vector.add(observer);
	}

	@Override
	public void del(Observer observer) {
		vector.remove(observer);
	}

	@Override
	public void notifyObservers() {
		Enumeration<Observer> enumo = vector.elements();  
        while(enumo.hasMoreElements()){  
            enumo.nextElement().update();
        }
	}

}
